package com.star.common.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * TODO
 *
 * @author xiaoqiang
 * @version 1.0
 * @date 2020/8/4 18:23
 */
public class VerifyUtil {

    public static boolean isPhone(String phone) {
        String regex = "^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\\d{8}$";
        if (phone.length() != 11) {
            return false;
        } else {
            Pattern p = Pattern.compile(regex);
            Matcher m = p.matcher(phone);
            boolean isMatch = m.matches();
            if (!isMatch) {
                boolean b = false;
                return b;
            }
            return isMatch;
        }
    }

    public static void main(String[] args) {
        System.out.println(isPhone("13296605357"));
    }
}
